package cn.tedu.store.controller;

import cn.tedu.store.entity.District;
import cn.tedu.store.service.IDistrictService;
import cn.tedu.store.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("districts")
public class DistrictController extends BaseController {

	@Autowired
	private IDistrictService districtService;
	
	@GetMapping("/")
	public JsonResult<List<District>> getByParent(String parent) {
		// 调用业务层对象执行查询
		List<District> data
			= districtService.getByParent(parent);
		// 返回成功和查询结果
		return new JsonResult<>(SUCCESS, data);
	}
	

}